package com.leyou.item.web;

import com.leyou.common.vo.PageResult;
import com.leyou.item.pojo.Brand;
import com.leyou.item.service.BrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: leyou
 * @description: 品牌控制层
 * @author: NieMiao
 * @create: 2018-11-08 11:52
 **/
@RestController
@RequestMapping("brand")
public class BrandController {
    @Autowired
    private BrandService brandService;
    @GetMapping("page")
    public PageResult<Brand> list(@RequestParam(value = "key",required = false)String key,
                                  @RequestParam(value = "page",defaultValue = "1")Integer page,
                                  @RequestParam(value = "rows",defaultValue = "5")Integer rows,
                                  @RequestParam(value = "sortBy",required = false)String sortBy,
                                  @RequestParam(value = "desc",defaultValue = "false")Boolean desc){
        PageResult<Brand> brandPageResult = brandService.queryListByParams(key, sortBy, page, rows, desc);
        return brandPageResult;
    }

}
